import axios from "axios";

export async function request(url: string, param?: any): Promise<{ code: number; data: any; msg?: string }> {
    const response: any = await axios.post(import.meta.env.VITE_API_URL + url, param, {
        headers: {
            Authorization: `Bearer ` + localStorage.getItem("token") || "",
        },
    });
    if (response.status === 200) {
        return response.data;
    }
    return { code: 0, data: null };
}
